<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="/tlopsmanage/lib/layui/css/layui.css">
    <link rel="stylesheet" href="/tlopsmanage/lib/login.css">
    <title>登录</title>
</head>
<body>
    <div class="container">
        <form class="layui-form" id="login" lay-filter="login" onkeydown="if(event.keyCode==13){return false;}">
            <button class="close" title="关闭">X</button>
            <div class="layui-form-mid layui-word-aux logo">
                <img src="/tlopsmanage/lib/logo.png" height="35"/>
            </div>
            <div class="layui-form-item" style="margin-top: 10px;">
                <label class="layui-form-label">用户名</label>
                <div class="layui-input-block">
                    <input type="text" name="username" required lay-verify="required" placeholder="请输入用户名"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item" style="margin-top: 30px;">
                <label class="layui-form-label">密  码</label>
                <div class="layui-input-inline">
                    <input type="password" name="password" required lay-verify="required" placeholder="请输入密码"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
        </form>
        <div class="layui-form-item" style="margin-top: 30px;">
            <div class="layui-input-block">
                <button class="layui-btn" onclick="tl_ops_manage_login()" style="letter-spacing: 40px;text-indent: 30px;">登录</button>
            </div>
        </div>
    </div>
    <script src="/tlopsmanage/lib/layui/layui.js"></script>
    <script src="/tlopsmanage/lib/tl_ops_web_comm.js"></script>
    <script>
        layui.use(['form', 'layedit', 'layer'], function () {
            window.form = layui.form;
            window.$ = layui.$;
            window.layer = layui.layer
            window.tl_ops_manage_login = function(){
                let data = form.val("login")
                if(data.username === '' || data.password === ''){
                    layer.msg("用户名密码不能为空")
                    return
                }
                $.ajax(tl_ajax_data({
                    url: '/tlops/auth/login',
                    data : JSON.stringify(data),
                    contentType : "application/json",
                    success : (res)=>{
                        layer.msg(res.msg)
                        setTimeout(() => {
                            window.location.reload()
                        }, 1000);
                    }
                }));
            }                
        });
    </script>
</body>

</html>